#include <stdio.h>
#include <stdlib.h>

struct Node
{
    int data;
    struct Node *next;
};

struct Node *front=NULL, *rear=NULL;

void enqueue(int x)
{
    struct Node* p = (struct Node*)malloc(sizeof(struct Node));
    p->data = x;
    p->next = NULL;
    if (front == NULL)
    {
        front = rear = p;
    }
    else
    {
        rear->next = p;
        rear = p;
    }
}

void dequeue()
{
    // if (front == NULL)
    // {
    //     printf("UnderFlow!\n");
    //     return;
    // }
    struct Node* q = front;
    front = front->next;
    free(q);
}

void peek()
{
    if (front == NULL)
    {
        printf("Empty!\n");
        return;
    }
    printf("%d\n", front->data);
}

void display()
{
    // if (front == NULL)
    // {
    //     printf("Empty!\n");
    //     return;
    // }
    struct Node* r = front;
    while(r != NULL) 
    {
        printf("%d ", r->data);
        r = r->next;
    }
    printf("\n");
}

int main()
{
    enqueue(5);
    enqueue(0);
    enqueue(-3);
    display();
    dequeue();
    peek();
}